﻿using System;
using System.Collections.Generic;
using System.Data.OracleClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Xiaov.SmartWeb.Infrastructure.ExtMethod;

namespace Xiaov.SmartWeb.Application.PluginSrc.StatisticalSystem
{
    public partial class CarryOn : System.Web.UI.Page
    {
        public string TableName { get; set; }
        public string Year { get; set; }
        public string Month { get; set; }
        public string DWBM { get; set; }
        public string PreYear { get; set; }
        public string PreMonth { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            TableName = Request.Form["tn"].ToRequestString();
            Year = Request.Form["year"].ToRequestString();
            Month = Request.Form["month"].ToRequestString();
            DWBM = Request.Form["dwbm"].ToRequestString();
            PreYear = Request.Form["preyear"].ToRequestString();
            PreMonth = Request.Form["premonth"].ToRequestString();
            LoadProc("p_carry");
        }
            

        /// <summary>
        /// 调用存储过程
        /// </summary>
        /// <param name="ProcdureName">过程名称</param>
        /// <returns>返回值</returns>
        public bool LoadProc(string ProcdureName)
        {
            OracleParameter[] parameters ={
            new OracleParameter("v_bbbm",OracleType.VarChar,20),
　　     new OracleParameter("v_dwbm",OracleType.VarChar,20),
　　     new OracleParameter("v_nf",OracleType.Number,4),
            new OracleParameter("v_yf",OracleType.Number,2),
            new OracleParameter("v_prenf",OracleType.Number,4),
            new OracleParameter("v_preyf",OracleType.Number,2)
　　      };
            parameters[0].Value = TableName.ToUpper();
            parameters[1].Value = DWBM.ToUpper();
            parameters[2].Value = Year;
            parameters[3].Value = Month;
            parameters[4].Value = PreYear;
            parameters[5].Value = PreMonth;
            try
            {
                OracleDataReader odr =  Maticsoft.DBUtility.DbHelperOra.RunProcedure(ProcdureName, parameters);
                odr.Close();
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}